package com.g360.sys.log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by vpc on 2015/11/30.
 */
@Aspect
public class LogAspect {
    private static final Logger LOGGER = LoggerFactory.getLogger(LogAspect.class);

    @Pointcut("execution(* com.g360.sys.controller..*.*(..))")
    public void logInfo() {

    }

    @Before("logInfo()")
    public void beforeAdvice(JoinPoint joinPoint) {
        LOGGER.info("beforeAdvice().invoke");
        LOGGER.info("info" + joinPoint.getArgs());
        LOGGER.info("end of beforeAdvice()");
    }

    @After("logInfo()")
    public void afterAdvice(JoinPoint joinPoint) {
        LOGGER.info("afterAdvice().invoke");
        LOGGER.info("info" + joinPoint.getArgs());
        LOGGER.info("end of afterAdvice()");
    }
}
